<?php
/**
 *      帮助中心
 *      [Jsen.net] (C)2013-2099 Jason Group Science and technology co., LTD.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      http://www.jsen.net
 *      tel:400-681-9511
 */
class LeagueController extends HomeBaseController{
    public function _initialize() {
        parent::_initialize();
        //$this->db = model('message');
    }

    /* 帮助中心首页 */
    public function index(){
		$SEO=seo(0,"申请入驻");
		$union_type = m('union_type')->order("id asc")->select();
		$region = model('region')->where(array('parent_id' => 1))->select();
        include template('league_index');
    }
	 public function apply(){
		
		$SEO=seo(0,"申请入驻");
        include template('league_apply');
    }
	public function doadd(){
		//echo "<pre>";
		//print_r($_REQUEST);
		//exit;
		//foreach($_REQUEST as $key=>$val){
			//echo '$data["'.$key.'"]=$_GET["'.$key.'"];<br>';	
		//}
		$where["phone"]=$_GET["phone"];
		$num=M("league")->where($where)->count();
		if($num>0){
			 showmessage('提交失败，请不要重复提交！','',1);
		}
		$data["company_name"]=$_GET["company_name"];
		$data["province"]=$_GET["province"];
		$data["city"]=$_GET["city"];
		$data["district"]=$_GET["district"];
		$data["realname"]=$_GET["realname"];
		$data["phone"]=$_GET["phone"];
		$data["address"]=$_GET["address"];
		$data["business"]=$_GET["business"];
		$data["fenlei"]=$_GET["fenlei"];
		$data["add_time"]=time();
		$res=M("league")->add($data);
	
		if ($res>0){
            showmessage('提交成功，请等待管理员与您联系！','index.php?m=league&c=league',1);
        }else{
            showmessage('提交失败，请重新提交！','',1);
        }
    }
	/**
     * ajax获取地区
     *@author wj 
     *@date  2014-10-14
     */
    public function getArea() {
        $where['parent_id'] = $_GET['areaId'];
        $area = M('region')->where($where)->select();
        $this->ajaxReturn($area);
    }

}